import request from '@/utils/request';
import { getPageSize } from '@/utils/common';

export async function upkeepList(params) {
  params.pageSize = params.pageSize || getPageSize();
  return request(`/server/api/tms/tms-upkeep/selectList`, {
    method: 'POST',
    body: params,
  });
}

export async function upkeepDetail(params) {
  return request(`/server/api/tms/tms-upkeep/viewDetails`, {
    method: 'POST',
    body: params,
  });
}

export async function upkeepAdd(params) {
  return request(
    `/server/api/tms/tms-upkeep/insertUpkeep`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}

export async function upkeepEdit(params) {
  return request(
    `/server/api/tms/tms-upkeep/updateUpkeep`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}

export async function upkeepInfoAdd(params) {
  return request(
    `/server/api/tms/tms-upkeep-detail/insertUpkeep`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}

export async function upkeepInfoEdit(params) {
  return request(
    `/server/api/tms/tms-upkeep-detail/updateUpkeep`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}

export async function upkeepInfoList(params) {
  return request(`/server/api/tms/tms-upkeep-detail/selectList`, {
    method: 'POST',
    body: params,
  });
}

export async function upkeepInfoDetail(params) {
  return request(`/server/api/tms/tms-upkeep-detail/viewDetails`, {
    method: 'POST',
    body: params,
  });
}

export async function importUpkeepDetail(params) {
  return request(`/server/api/tms/tms-upkeep-detail/importUpkeepDetail`, {
    method: 'POST',
    body: params,
  });
}

export async function carList(params) {
  return request(`/server/api/tms/tms-upkeep/selectVehicle`, {
    method: 'POST',
    body: params,
  });
}
/**
 * 生成账单
 */
export async function generatedBills(params) {
  return request(`/server/api/tms/tms-upkeep/generateBill`, {
    method: 'POST',
    body: params,
  });
}

//删除记录
export async function deleteUpkeep(params) {
  return request(`/server/api/tms/tms-upkeep/deleteTmsUpkeep`, {
    method: 'POST',
    body: params,
  });
}
//删除明细
export async function deleteUpkeepInfo(params) {
  return request(`/server/api/tms/tms-upkeep-detail/deleteTmsUpkeepDetail`, {
    method: 'POST',
    body: params,
  });
}

export async function selectAll(params) {
  return request(`/server/api/tms/tms-upkeep/generateBillByCheckAll`, {
    method: 'POST',
    body: params,
  });
}
